package wrapper.homework;

import java.util.Scanner;

/**
 * @Author Justin Parker
 * @Date 2024/7/12 0012 19:08
 * @Version 1.0
 */
public class Test01 {
    public static void main(String[] args) {

//        String regex ="([0-9a-zA-Z_]+){3,15}";
        System.out.println("请输入用户名：");
        Scanner sc = new Scanner(System.in);
        String name = sc.nextLine();

        boolean match = name.matches("([0-9a-zA-Z_]+){3,15}");
        if(match){
            System.out.println("请继续输入年龄");
        }else{
            System.out.println("您输入的用户名不合法");
            return;
        }
        String age = sc.nextLine();
//        String regex1 = "[0-9]{1,3}";
        boolean match1 = age.matches("[0-9]{1,3}");
        if (match1){

        }else{
            System.out.println("输入的年龄有误");
            return;
        }
        int age1= Integer.parseInt(age);
        if (age1>=1 && age1<=100){
            System.out.println("恭喜你，登录成功");
        }else {
            System.out.println("输入的年龄有误");
        }
    }
}
